package tanke;

public class Tank {//坦克父类
    //需有两个坐标
    private int x;
    private int y;//y坐标
    private int direct;//表示坦克方向0上1右 2下 3左
    private int speed;
    public Tank(int x, int y) {
        this.x = x;
        this.y = y;
    }

//移动方法
    public void moveUp(){

        y-=speed;
    }
    public void moveRight(){

        x+=speed;

    }
    public void moveDown(){

        y+=speed;
    }
    public  void moveLeft(){

        x-=speed;
    }


    public int getX() {
        return x;
    }

    public int getSpeed() {
        return speed;
    }

    public void setSpeed(int speed) {
        this.speed = speed;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public int getDirect() {
        return direct;
    }

    public void setDirect(int direct) {
        this.direct = direct;
    }
}